package untils

import "regexp"

const (
	licensePlatePattern        = "^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领]{1}[A-HJ-NP-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$" //车牌号
	vinCodePattern             = "^[A-HJ-NPR-Z0-9]{17}$"                                                                         //VIN码
	carBrainNumberPattern      = "^[A-Z0-9-]{5,20}$"                                                                             //车脑编号
	largeScreenNumberPattern   = "^[A-Z0-9_-]{6,25}$"                                                                            //大屏编号
	engineOrMotorNumberPattern = "^[A-Za-z0-9]{8,17}$"                                                                           //发动机号/电动机号
)

// LicensePlateRegexp 校验车牌号格式
func LicensePlateRegexp(licensePlate string) bool {
	matched, _ := regexp.MatchString(licensePlatePattern, licensePlate)
	return matched
}

// VinCodeRegexp 校验VIN码格式
func VinCodeRegexp(vinCode string) bool {
	matched, _ := regexp.MatchString(vinCodePattern, vinCode)
	return matched
}

// CarBrainNumberRegexp 校验车载大脑编号格式
func CarBrainNumberRegexp(carBrainNumber string) bool {
	matched, _ := regexp.MatchString(carBrainNumberPattern, carBrainNumber)
	return matched
}

// LargeScreenNumberRegexp 校验大屏编号格式
func LargeScreenNumberRegexp(largeScreenNumber string) bool {
	matched, _ := regexp.MatchString(largeScreenNumberPattern, largeScreenNumber)
	return matched
}

// EngineOrMotorNumberRegexp 校验发动机号/电动机号格式
func EngineOrMotorNumberRegexp(engineOrMotorNumber string) bool {
	matched, _ := regexp.MatchString(engineOrMotorNumberPattern, engineOrMotorNumber)
	return matched
}
